<!DOCTYPE html>
<html>
<head>
    <title>批量打印页面</title>
<#include "../common/common.ftl"/>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <form class="layui-form">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">《安置流程卡》</li>
                    <li>《选房安置告知书》</li>
                    <li>《选房安置通知书》</li>
                    <li>《选房安置资格审查表》</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-card">
                            <div class="layui-card-header">请先选择征收项目然后选择选房安排时间<span style="color:red;">（注：选房安排时间必选）</span>,然后再进行打印：
                            </div>
                            <div class="layui-card-body">
                                <div class="layui-card">
                                    <div class="layui-card-body">
                                        <div class="layui-form-item">
                                            <div class="layui-inline layui-hide-xs">征收项目名称：</div>
                                            <div class="layui-col-xs12">
                                            <#list zsProjectList as zsProject>
                                                <a class="layui-btn loadZsProject" zsProjectId="${(zsProject.id)!}" lay-verify="required"><i class="layui-icon layui-icon-home"></i>${(zsProject.projectName)!}</a>
                                            </#list>
                                            </div>
                                        </div>
                                        <div class="layui-inline layui-hide-xs">安排选房时间：</div>
                                        <div class="layui-card-body" id="selectDateInfo">

                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <button class="layui-btn" style="margin-left: 20px;" type="button" id="printProcess"><i class="layui-icon layui-icon-print"></i> 批量打印安置流程卡</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-card">
                            <div class="layui-card-header">请先选择征收项目然后选择选房安排时间<span style="color:red;">（注：选房安排时间必选）</span>,然后再进行打印：
                            </div>
                            <div class="layui-card-body">
                                <div class="layui-card">
                                    <div class="layui-card-body">
                                        <div class="layui-form-item">
                                            <div class="layui-inline layui-hide-xs">征收项目名称：</div>
                                            <div class="layui-col-xs12">
                                            <#list zsProjectList as zsProject>
                                                <a class="layui-btn loadZsProject1" zsProjectId="${(zsProject.id)!}" lay-verify="required"><i class="layui-icon layui-icon-home"></i>${(zsProject.projectName)!}</a>
                                            </#list>
                                            </div>
                                        </div>
                                        <div class="layui-inline layui-hide-xs">安排选房时间：</div>
                                        <div class="layui-card-body" id="selectDateInfo1">

                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <button class="layui-btn" style="margin-left: 20px;" type="button" id="printGZ"><i class="layui-icon layui-icon-print"></i> 批量打印选房告知书</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-card">
                            <div class="layui-card-header">请先选择征收项目然后选择选房安排时间<span style="color:red;">（注：选房安排时间必选）</span>,然后再进行打印：
                            </div>
                            <div class="layui-card-body">
                                <div class="layui-card">
                                    <div class="layui-card-body">
                                        <div class="layui-form-item">
                                            <div class="layui-inline layui-hide-xs">征收项目名称：</div>
                                            <div class="layui-col-xs12">
                                            <#list zsProjectList as zsProject>
                                                <a class="layui-btn loadZsProject2" zsProjectId="${(zsProject.id)!}" lay-verify="required"><i class="layui-icon layui-icon-home"></i>${(zsProject.projectName)!}</a>
                                            </#list>
                                            </div>
                                        </div>
                                        <div class="layui-inline layui-hide-xs">安排选房时间：</div>
                                        <div class="layui-card-body" id="selectDateInfo2">

                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <button class="layui-btn" style="margin-left: 20px;" type="button" id="printAll"><i class="layui-icon layui-icon-print"></i> 批量打印选房通知书</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab-item">
                        <div class="layui-card">
                            <div class="layui-card-header">请先选择征收项目然后选择选房安排时间<span style="color:red;">（注：选房安排时间必选）</span>,然后再进行打印：
                            </div>
                            <div class="layui-card-body">
                                <div class="layui-card">
                                    <div class="layui-card-body">
                                        <div class="layui-form-item">
                                            <div class="layui-inline layui-hide-xs">征收项目名称：</div>
                                            <div class="layui-col-xs12">
                                            <#list zsProjectList as zsProject>
                                                <a class="layui-btn loadZsProject3" zsProjectId="${(zsProject.id)!}" lay-verify="required"><i class="layui-icon layui-icon-home"></i>${(zsProject.projectName)!}</a>
                                            </#list>
                                            </div>
                                        </div>
                                        <div class="layui-inline layui-hide-xs">安排选房时间：</div>
                                        <div class="layui-card-body" id="selectDateInfo3">

                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <button class="layui-btn" style="margin-left: 20px;" type="button" id="printZg"><i class="layui-icon layui-icon-print"></i> 批量打印资格审查表</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <button style="display: none;" class="layui-btn" id="submitBtn" name="submitBtn" lay-submit=""
                    lay-filter="submit">
                立即提交
            </button>
        </form>
    </div>
</div>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>

    layui.config({
        base: '/modules/' //静态资源所在路径
    }).use(['form', 'jquery', 'jmdf', 'element'], function () {
        var form = layui.form, $ = layui.jquery, jmdf = layui.jmdf,
                element = layui.element, //Tab的切换功能，切换事件监听等，需要依赖element模块
                parentIndex = parent.layer.getFrameIndex(window.name);

        var zsProjectId = 0;

        //加载安置流程卡页面的项目等信息
        $(".loadZsProject").click(function () {
            var obj = $(this);
            $(".loadZsProject").removeClass("layui-btn-danger");
            obj.addClass("layui-btn-danger");

            zsProjectId = obj.attr("zsProjectId");
            $.get("loadChooseDate", {zsProjectId: zsProjectId, type: 1, _time: new Date().getTime()}, function (data) {
                $("#selectDateInfo").html(data);
                form.render();
            });
        });

        //加载选房告知书页面的项目等信息
        $(".loadZsProject1").click(function () {
            var obj = $(this);
            $(".loadZsProject1").removeClass("layui-btn-danger");
            obj.addClass("layui-btn-danger");

            zsProjectId = obj.attr("zsProjectId");
            $.get("loadChooseDate", {zsProjectId: zsProjectId, type: 2, _time: new Date().getTime()}, function (data) {
                $("#selectDateInfo1").html(data);
                form.render();
            });
        });

        //加载选房通知书页面的项目等信息
        $(".loadZsProject2").click(function () {
            var obj = $(this);
            $(".loadZsProject2").removeClass("layui-btn-danger");
            obj.addClass("layui-btn-danger");

            zsProjectId = obj.attr("zsProjectId");
            $.get("loadChooseDate", {zsProjectId: zsProjectId, type: 1, _time: new Date().getTime()}, function (data) {
                $("#selectDateInfo2").html(data);
                form.render();
            });
        });

        //加载资格审查表页面的项目等信息
        $(".loadZsProject3").click(function () {
            var obj = $(this);
            $(".loadZsProject3").removeClass("layui-btn-danger");
            obj.addClass("layui-btn-danger");

            zsProjectId = obj.attr("zsProjectId");
            $.get("loadChooseDate", {zsProjectId: zsProjectId, type: 2, _time: new Date().getTime()}, function (data) {
                $("#selectDateInfo3").html(data);
                form.render();
            });
        });

        //批量打印安置流程卡按钮点击事件
        $("#printProcess").click(function () {
            var chooseDate = "";

            $("input[name='chooseDate']:checked").each(function () {

                chooseDate += "'" + $(this).attr("value") + "',";
            });
            if (chooseDate.length > 0) {
                chooseDate = chooseDate.substring(0, chooseDate.length - 1)
            }
            if (chooseDate != "") {
                $.get("countContractData", {zsProjectId: zsProjectId, preChooseDate: chooseDate, type: 2, _time: new Date().getTime()}, function (data) {
                    if (data.code == "0001") {//成功
                        layer.msg(data.message, {anim: 0, icon: 1, time: 6000});
                    }
                });

                jmdf.print("batchProcessPrint?zsProjectId=" + zsProjectId + "&preChooseDate=" + chooseDate + "&type=" + 2, "60");
            } else {
                layer.msg("请选择选房安排时间", {anim: 0, icon: 2, time: 6000});
            }
        });

        //批量打印选房告知书按钮点击事件
        $("#printGZ").click(function () {
            var chooseDate = "";

            $("input[name='chooseDate']:checked").each(function () {

                chooseDate += "'" + $(this).attr("value") + "',";
            });
            if (chooseDate.length > 0) {
                chooseDate = chooseDate.substring(0, chooseDate.length - 1)
            }
            if (chooseDate != "") {
                $.get("countContractData", {zsProjectId: zsProjectId, preChooseDate: chooseDate, type: 2, _time: new Date().getTime()}, function (data) {
                    if (data.code == "0001") {//成功
                        layer.msg(data.message, {anim: 0, icon: 1, time: 6000});
                    }
                });

                jmdf.print("batchGzBillPrint?zsProjectId=" + zsProjectId + "&preChooseDate=" + chooseDate + "&type=" + 2, "60");
            } else {
                layer.msg("请选择选房安排时间", {anim: 0, icon: 2, time: 6000});
            }
        });

        //批量打印选房通知书按钮点击事件
        $("#printAll").click(function () {
            var chooseDate = "";

            $("input[name='chooseDate']:checked").each(function () {

                chooseDate += "'" + $(this).attr("value") + "',";
            });
            if (chooseDate.length > 0) {
                chooseDate = chooseDate.substring(0, chooseDate.length - 1)
            }
            if (chooseDate != "") {
                $.get("countContractData", {zsProjectId: zsProjectId, preChooseDate: chooseDate, type: 2, _time: new Date().getTime()}, function (data) {
                    if (data.code == "0001") {//成功
                        layer.msg(data.message, {anim: 0, icon: 1, time: 6000});
                    }
                });

                jmdf.print("batchChooseNoticePrint?zsProjectId=" + zsProjectId + "&preChooseDate=" + chooseDate + "&type=" + 2, "60");
            } else {
                layer.msg("请选择选房安排时间", {anim: 0, icon: 2, time: 6000});
            }

        });

        //批量打印资格审查表按钮点击事件
        $("#printZg").click(function () {
            var chooseDate = "";

            $("input[name='preChooseDate']:checked").each(function () {

                chooseDate += "'" + $(this).attr("value") + "',";
            });
            if (chooseDate.length > 0) {
                chooseDate = chooseDate.substring(0, chooseDate.length - 1)
            }

            if (chooseDate != "") {
                $.get("countContractData", {zsProjectId: zsProjectId, preChooseDate: chooseDate, type: 2, _time: new Date().getTime()}, function (data) {
                    if (data.code == "0001") {//成功
                        layer.msg(data.message, {anim: 0, icon: 1, time: 6000});
                    }
                });

                jmdf.print("batchReviewTablePrint?zsProjectId=" + zsProjectId + "&preChooseDate=" + chooseDate + "&type=" + 2, "60");
            } else {
                layer.msg("请选择选房安排时间", {anim: 0, icon: 2, time: 6000});
            }

        });

    });
</script>
</body>
</html>